﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LanCommunity
{
    public partial class ShowMessageForm : Form
    {
        public enum ShowMessageType
        {
            Information,
            DeleteDevices
        }

        public ShowMessageForm(ShowMessageType type, string title, string message)
        {
            InitializeComponent();

            //tytuł okna
            this.Text = title;

            //wiadomość
            labelInfo.Text = message;

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowMessageForm));
            switch (type)
            {
                case ShowMessageType.Information:
                    {
                        //ikonka
                        pbIcon.Image = ((System.Drawing.Image)(resources.GetObject("info_big")));

                        //pokaż jeden przycisk
                        //pozycja i rozmiar przycisku btnNo
                        btnNo.Visible = false;
                        btnYes.Bounds = btnNo.Bounds;
                        btnYes.Text = "OK";
                        btnYes.DialogResult = DialogResult.OK;
                    } break;

                case ShowMessageType.DeleteDevices:
                    {
                        //ikonka
                        pbIcon.Image = ((System.Drawing.Image)(resources.GetObject("delete_devices_big")));
                    } break;

                default:
                    break;
            }
        }

        /// <summary>
        /// Pokazuje wiadomość
        /// </summary>
        /// <returns></returns>
        public static DialogResult ShowMessage(Icon icon, ShowMessageType type, string title, string message)
        {
            ShowMessageForm deleteDevicesForm = new ShowMessageForm(type, title, message);
            deleteDevicesForm.Icon = icon;
            return deleteDevicesForm.ShowDialog();
        }
    }
}
